case class Book(title: String, author: String, isbn: String) {
  var available = true

  def borrowBook(): Unit = {
    if (available) {
      available = false
      println(s"You have borrowed the book '$title' by $author (ISBN: $isbn)")
    } else {
      println(s"Sorry, the book '$title' is not available.")
    }
  }

  def returnBook(): Unit = {
    if (!available) {
      available = true
      println(s"You have returned the book '$title' by $author (ISBN: $isbn)")
    } else {
      println(s"The book '$title' was not borrowed.")
      // Library类
class Library {
  private val availableBooks = scala.collection.mutable.ListBuffer[Book]()
  private val borrowedBooks = scala.collection.mutable.ListBuffer[Book]()

  def addBook(book: Book): Unit = {
    availableBooks += book
    println(s"The book '${book.title}' by ${book.author} (ISBN: ${book.isbn}) has been added to the library.")
  }

  def borrowBook(isbn: String): Unit = {
    val book = availableBooks.find(_.isbn == isbn)
    book match {
      case Some(b) =>
        b.borrowBook()
        availableBooks -= b
        borrowedBooks += b
      case None =>
        println(s"No book found with ISBN: $isbn")
    }
  }

  def returnBook(isbn: String): Unit = {
    val book = borrowedBooks.find(_.isbn == isbn)
    book match {
      case Some(b) =>
        b.returnBook()
        borrowedBooks -= b
        availableBooks += b
      case None =>
        println(s"No book found with ISBN: $isbn")
    }
  }

  def printAvailableBooks(): Unit = {
    println("Available Books:")
    availableBooks.foreach(b => println(s"Title: ${b.title}, Author: ${b.author}, ISBN: ${b.isbn}"))
  }

  def printBorrowedBooks(): Unit = {
    println("Borrowed Books:")
    borrowedBooks.foreach(b => println(s"Title: ${b.title}, Author: ${b.author}, ISBN: ${b.isbn}"))
  }
}

